package com.android.scj.tc.bean;

/**
 *
 * 透明通道返回
 *
 */
public class TTransmissionResponse {
	/**
	 * 0 1 Status 0x00表示收到VST，0x01表示未收到VST 1 n VST Status为0x00时，有此域；0x01时此域长度为0
	 */
	private static final String cmdcode = "E2";
	private String Status = "";
	private String hexstr = "";
	private CMD_55AA cmd = null;

	private TTransmissionResponse() {
	}

	public static TTransmissionResponse disassemble(String hexstr) {
		TTransmissionResponse bst = new TTransmissionResponse();
		bst.cmd = CMD_55AA.disassemble(hexstr);
		if (bst.cmd == null)
			return null;
		if (!bst.cmd.getCMD().equals(cmdcode))
			return null;
		if (bst.cmd.getDATA().length() < 2
				|| bst.cmd.getDATA().length() % 2 == 1)
			return null;
		bst.Status = bst.cmd.getDATA().substring(0, 2);
		bst.hexstr = bst.cmd.getDATA().substring(2);
		return bst;
	}

	public String getStatus() {
		return Status;
	}

	public String getHexstr() {
		return hexstr;
	}

}
